from datetime import timedelta

import logging
from redis import StrictRedis


class Config(object):
    SECRET_KEY = "sadfasdfasdfasdfadfs"
    DEBUG = True
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:mysql@127.0.0.1:3306/information17"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379
    SESSION_TYPE = "redis"
    SESSION_USE_SIGNER = True
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    PERMANENT_SESSION_LIFETIME = timedelta(days=2)

    LOG_LEVEL = logging.DEBUG


class DevelopConfig(Config):
    pass

class ProductConfig(Config):
    DEBUG = False
    LOG_LEVEL = logging.ERROR

class TestConfig(Config):
    pass

config_dict = {
    "develop":DevelopConfig,
    "product":ProductConfig,
    "test":ProductConfig
}